# Contributor: Thomas Boerger <thomas@webhippie.de>
# Maintainer: Thomas Boerger <thomas@webhippie.de>
pkgname=py3-sqlparse
_pkgname=sqlparse
pkgver=0.4.4
pkgrel=1
pkgdesc="A non-validating SQL parser module for Python"
url="https://sqlparse.readthedocs.io/"
arch="noarch"
license="BSD-3-Clause"
depends="python3"
makedepends="
	py3-flit-core
	py3-gpep517
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-sqlparse" # Backwards compatibility
provides="py-sqlparse=$pkgver-r$pkgrel" # Backwards compatibility

# secfixes:
#   0.4.2-r0:
#     - CVE-2021-32839

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
bb655f8de2466c2ed51aca901b6561b8ac7730bf65f1254d218d7b9dabbece609cadd8a52a092b301895ad83813ddf02691e2de49cf55a26e676a2661c240a2b  sqlparse-0.4.4.tar.gz
"
